<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>使用matchAll完成全局匹配</title>
</head>
<body>
    <main>
        <h1>Jimmy</h1>
        <h2>Hello</h2>
        <h3>Welcome</h3>
    </main>
</body>
<script>
    const main = document.querySelector('main')
    const reg = /<(h[1-6])>([\s\S]+?)<\/\1>/ig
    console.log(main.innerHTML)
    console.log(main.innerHTML.match(reg))
    console.log(main.innerHTML.matchAll(reg))
</script>
</html>